<template>
  <div class="rank-card">
    <div class="flex-row">
      <span class="rank-card__index">{{ index }}</span>
      <span class="rank-card__name">{{ data.nickname }}</span>
    </div>

    <span class="rank-card__score">{{ data.score || 0 }}</span>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      required: true
    }
  },
  computed: {
    index() {
      // return (this.data.idx + '').padStart(2, '0')
      return this.data.idx
    }
  }
}
</script>

<style lang="less">
.rank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 36px;
  color: #666666;
  padding: 40px 40px;
  box-shadow: inset 0 -2px 0 0 #f5f5f5;

  &__index {
    display: inline-block;
    min-width: 120px;
    font-family: monospace;
    margin-right: 16px;
    &::before {
      content: 'NO.';
    }
  }

  &__name {
    color: #333333;
  }

  &__score {
    color: lighten(@primary, 10%)
  }

  &:nth-child(1),
  &:nth-child(2),
  &:nth-child(3) {
    .rank-card__index {
      font-weight: bold;
      color: @primary;
    }
  }
}
</style>
